
const TectCase = {
    page:1,
    getCaseInfo: function (page) {
        let _this = this;
        ajax_get(host + `/ajax/projectList/${page}`,
            true,
            {},
            (res) => {
                res = JSON.parse(res)
                console.log(res)
                if (res.list && res.list.length > 0)
                    _this.renderHtml(res.list)
                    _this.page = res.page
                    _this.renderPageHtml(res)
            },
            err => {
                console.log(err)
            }
        );
    },
    renderHtml(data) {
        if (data && data.length > 0) {
            let str = ''
            data.forEach(item => {
                str += `  <div class="case-list-li wow fadeInUp d2">
                <div class="imgJsWrap">
                    <a class="img-black" href="case-detail.html?id=${item.id}">
                        <div class="case-list-left">
                            <div class="case-list-img cover data3 data-seo3">
                                <img src="${item.image}" alt="">
                            </div>
                        </div>
                        <div class="case-list-right">
                            <div class="case-list-read">
                                <div class="case-list-title space-over" title="${item.title}">
                                ${item.title}</div>
                                <div class="case-list-text space-list-over">
                                ${item.descript}</div>
                            </div>
                            <div class="case-list-icon">
                                <span>MORE</span>
                            </div>
                        </div>
                    </a>
                </div>
            </div>`
            })
            $(".case-list-box").html(str)
        }
    },
    renderPageHtml:function(res){
        let _this = this;
        $('.page-lable-wrap').pagination({
            pageCount: res.page_num,
            coping: true,
            current: _this.page,
            jump: false,
            coping: true,
            homePage: '首页',
            endPage: '末页',
            prevContent: '上页',
            nextContent: '下页',
            callback: function (api) {
                _this.page = api.getCurrent()
                _this.getCaseInfo(_this.page)
            }
        });

    }
}

$(function () {
    common.init()
    common.getPhoneInfo()
    common.getBanner("project")
    common.getFootProductCatList()
    common.getFootInfo()
    TectCase.getCaseInfo(1)
})